package com.xuyuan.jdk.test;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public class Main {
    public static void main(String[] args) {
        List<Person> people = Arrays.asList(
                new Person("Alice", "New York", 30),
                new Person("Bob", "Los Angeles", 25),
                new Person("Alice", "New York", 30),
                new Person("Charlie", "Chicago", 28),
                new Person("Alice", "Chicago", 30)
        );

        List<Person> distinctPeople = people.stream()
                .distinct()
                .collect(Collectors.toList());

        distinctPeople.forEach(System.out::println);
    }
}
